package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CategoryMapper {



    @Delete("delete from sky_take_out.category where id=#{id}")
    void deleteById(Long id);

    @Select("select * from sky_take_out.category where id=#{id}")
    String getCategoryNameById(Long id);

    Page<Category> list(String name, Integer type,Integer status);
    // 带默认值的重载方法
    default Page<Category> list(String name, Integer type) {
        return list(name, type, null);
    }




    @AutoFill(value = OperationType.INSERT)
    void insert(Category category);



    @AutoFill(value = OperationType.UPDATE)
    void update(Category category);
}
